package com.bootdo.acitvity.DDD.application.dubbo.listener;

import com.bootdo.acitvity.DDD.application.controller.dto.StockDistributionDto;
import com.bootdo.acitvity.DDD.application.dubbo.dto.MQChannel;
import com.bootdo.acitvity.DDD.interences.StockAdjustmentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;

@Slf4j
@EnableBinding(MQChannel.class)
public class MQSyncListener {

    @Autowired
    private StockAdjustmentService stockAdjustmentService;

    @StreamListener("BATCH_STOCK_SYNC_INPUT")
    public void batchStockSyncConsumer(StockDistributionDto stockDistributionDto) {
        stockAdjustmentService.distributionStock(stockDistributionDto);
    }

}